import request from "../utils/request"
//登录接口
export function login(data) {
    return request({
        method: "post",
        url: "/login",
        data
    })
}

//注册接口
export function register(data) {
    return request({
        method: "post",
        url: "/register",
        data
    })
}

//用户信息获取
export function userInfo(id) {
    return request({
        method: "get",
        url: "/user/" + id,
        headers: {
            //需要通过headers属性传token给后端
            //用token判断用户身份是否正确
            Authorization: localStorage.getItem("ly-14-token")
        }
    })
}

//上传接口函数
export function upload(data) {
    return request({
        method: "POST",
        url: "/upload",
        data
    })
}

//编辑用户信息接口
export function update(id, data) {
    return request({
        method: "POST",
        url: "/user_update/" + id,
        data
    })
}

//关注用户的接口
export function user_follows(id) {
    return request({
        method: "get",
        url: "/user_follows/" + id,
    })
}

//取消关注用户接口
export function user_unfollow(id) {
    return request({
        method: "get",
        url: "/user_unfollow/" + id
    })
}

//点赞用户接口
export function post_like(id) {
    return request({
        method: "get",
        url: "/post_like/" + id
    })
}